package cn.iocoder.yudao.module.system.dal.mysql.standard;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.standard.vo.StandardPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.standard.StandardDO;
import org.apache.ibatis.annotations.Mapper;
/**
 * 存储健康指标基准值，上下限通过计算规则动态生成 Mapper
 *
 * @author 安捷星
 */
@Mapper
public interface StandardMapper extends BaseMapperX<StandardDO> {

    default PageResult<StandardDO> selectPage(StandardPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StandardDO>()
                .betweenIfPresent(StandardDO::getRecordTime, reqVO.getRecordTime())
                .eqIfPresent(StandardDO::getHeartRate, reqVO.getHeartRate())
                .eqIfPresent(StandardDO::getSystolicPressure, reqVO.getSystolicPressure())
                .eqIfPresent(StandardDO::getDiastolicPressure, reqVO.getDiastolicPressure())
                .eqIfPresent(StandardDO::getOxygenSaturation, reqVO.getOxygenSaturation())
                .eqIfPresent(StandardDO::getStress, reqVO.getStress())
                .eqIfPresent(StandardDO::getRichSore, reqVO.getRichSore())
                .betweenIfPresent(StandardDO::getReactionTime, reqVO.getReactionTime())
                .eqIfPresent(StandardDO::getGripStrength, reqVO.getGripStrength())
                .eqIfPresent(StandardDO::getVitalCapacity, reqVO.getVitalCapacity())
                .eqIfPresent(StandardDO::getBreathAlcohol, reqVO.getBreathAlcohol())
                .betweenIfPresent(StandardDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StandardDO::getId));
    }

}